/* stream_cipher_test.c
** 
** Copyright (c) 2007, Matt Hamrick, Siobhan Murtagh & Damon Orecks
** All rights reserved.
** 
** Redistribution  and  use  in  source  and  binary  forms,  with  or  without
** modification, are permitted provided that the following conditions are met:
** 
**  * Redistributions of  source code must  retain the above  copyright notice,
**    this list of conditions and the following disclaimer.
** 
**  * Redistributions in binary form must reproduce the above copyright notice,
**    this list of conditions and the following disclaimer in the documentation
**    and/or other materials provided with the distribution.
** 
**  * Neither  the  name  of the  DangerThink  Project  nor  the names  of  its
**    contributors may be used to endorse or promote products derived from this
**    software without specific prior written permission.
** 
** THIS SOFTWARE IS PROVIDED BY  THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY  EXPRESS OR IMPLIED WARRANTIES,  INCLUDING, BUT NOT  LIMITED TO, THE
** IMPLIED WARRANTIES  OF MERCHANTABILITY AND FITNESS FOR  A PARTICULAR PURPOSE
** ARE DISCLAIMED.  IN NO  EVENT SHALL THE  COPYRIGHT OWNER OR  CONTRIBUTORS BE
** LIABLE  FOR  ANY  DIRECT,   INDIRECT,  INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR
** CONSEQUENTIAL  DAMAGES  (INCLUDING,  BUT  NOT  LIMITED  TO,  PROCUREMENT  OF
** SUBSTITUTE GOODS  OR SERVICES;  LOSS OF USE,  DATA, OR PROFITS;  OR BUSINESS
** INTERRUPTION)  HOWEVER CAUSED  AND ON  ANY THEORY  OF LIABILITY,  WHETHER IN
** CONTRACT,  STRICT LIABILITY,  OR  TORT (INCLUDING  NEGLIGENCE OR  OTHERWISE)
** ARISING IN ANY WAY  OUT OF THE USE OF THIS SOFTWARE,  EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
**
** $Id: stream_cipher_test.c 16 2007-05-11 22:39:57Z msh.mobile $
*/

#include <CUnit/CUnit.h>
#include "test_crypto.h"
#include "stream_cipher_test.h"
#include "hc256_test.h"

tErr add_stream_cipher_suites( tApp *app ) {
  tErr err = APP_E_NOERR;

  CU_pSuite current_suite;
  CU_pTest  current_test;

  do {
    if( NULL == app ) {
      err = APP_E_BADPARAM;
      break;
    }

    /* Add A5/1 tests */

    /* Add A5/2 tests */

    /* Add ABC tests */

    /* Add Achterbahn tests */

    /* Add ARC-4 tests */

    /* Add Chameleon tests */

    /* Add CryptMT tests */

    /* Add DECIM tests */

    /* Add DICING tests */

    /* Add Dragon tests */

    /* Add Edon80 tests */

    /* Add F-FCSR tests */

    /* Add FISH tests */

    /* Add Grain tests */

    /* Add HC-128 tests */

    /* Add HC-256 tests */

    if( NULL == ( current_suite = CU_add_suite( "HC-256", hc256_test_init, hc256_test_clean ) ) ) {
      err = APP_E_SUITE;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "hc256_lower test vector 1", hc256_test_lower1) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "hc256_lower test vector 2", hc256_test_lower2) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "hc256_lower test vector 3", hc256_test_lower3) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "hc256_lower test vector 4", hc256_test_lower4) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "new with null cipher pointer", hc256_test_new_null) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "new with non-null cipher pointer", hc256_test_new_non_null) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "key", hc256_test_key) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "key null cipher", hc256_test_key_null_cipher) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "key null key", hc256_test_key_null_key) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "key null cipher and key", hc256_test_key_null_cipher_and_key) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "iv", hc256_test_iv) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "iv null cipher", hc256_test_iv_null_cipher) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "iv null iv", hc256_test_iv_null_iv) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "iv null cipher and iv", hc256_test_iv_null_cipher_and_iv) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "init", hc256_test_initf) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "init null cipher", hc256_test_initf_null_cipher) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream", hc256_test_keystream) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null cipher, output and bytes_written", hc256_test_keystream_null_cipher_output_bytes ) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null cipher and output", hc256_test_keystream_null_cipher_output) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null cipher and bytes_written", hc256_test_keystream_null_cipher_bytes) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null cipher", hc256_test_keystream_null_cipher) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null output and bytes_written", hc256_test_keystream_null_output_bytes) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null output", hc256_test_keystream_null_output) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream null bytes_written", hc256_test_keystream_null_bytes) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream zero length", hc256_test_keystream_zero_length) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "keystream zero length, null bytes_written", hc256_test_keystream_zero_length_null_bytes) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt", hc256_test_encrypt) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt null cipher", hc256_test_encrypt_null_cipher) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt null input", hc256_test_encrypt_null_input) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt null output", hc256_test_encrypt_null_output) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt null bytes_written", hc256_test_encrypt_null_bytes) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt zero input length", hc256_test_encrypt_zero_input_length) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "encrypt zero output length", hc256_test_encrypt_zero_output_length) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "decrypt", hc256_test_decrypt) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "seek absolute forward", hc256_test_absolute_forward) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "seek absolute backward", hc256_test_absolute_backward) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "seek relative forward", hc256_test_relative_forward) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "seek relative backward", hc256_test_relative_backward) ) ) {
      err = APP_E_TEST;
      break;
    }    

    if( NULL == ( current_test = CU_add_test( current_suite, "seek null cipher", hc256_test_seek_null_cipher) ) ) {
      err = APP_E_TEST;
      break;
    }    

    if( NULL == ( current_test = CU_add_test( current_suite, "seek invalid mode", hc256_test_seek_invalid_mode) ) ) {
      err = APP_E_TEST;
      break;
    }    

    if( NULL == ( current_test = CU_add_test( current_suite, "seek negative absolute", hc256_test_seek_negative_absolute) ) ) {
      err = APP_E_TEST;
      break;
    }    

    if( NULL == ( current_test = CU_add_test( current_suite, "clear", hc256_test_clear) ) ) {
      err = APP_E_TEST;
      break;
    }    

    if( NULL == ( current_test = CU_add_test( current_suite, "delete", hc256_test_delete) ) ) {
      err = APP_E_TEST;
      break;
    }    

    if( NULL == ( current_test = CU_add_test( current_suite, "vector 1", hc256_test_vector1) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "vector 2", hc256_test_vector2) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "vector 3", hc256_test_vector3) ) ) {
      err = APP_E_TEST;
      break;
    }

    if( NULL == ( current_test = CU_add_test( current_suite, "vector 4", hc256_test_vector4) ) ) {
      err = APP_E_TEST;
      break;
    }

    /* Add Helix tests */

    /* Add Hermes8 tests */

    /* Add ISAAC tests */

    /* Add LEX tests */

    /* Add MICKEY tests */

    /* Add MOUSTIQUE tests */

    /* Add MUGI tests */

    /* Add NLS tests */
    
    /* Add PANAMA tests */

    /* Add Phelix tests */

    /* Add Pike tests */

    /* Add Polar Bear tests */

    /* Add POMARANCH tests */

    /* Add Py tests */

    /* Add Rabbit tests */

    /* Add Salsa20 tests */

    /* Add SCREAM tests */

    /* Add SEAL tests */

    /* Add SNOW tests */

    /* Add SOBER-128 tests */

    /* Add SOSEMANUK tests */

    /* Add Trivium tests */

    /* Add TSC-4 tests */

    /* Add Turing tests */

    /* Add VEST tests */

    /* Add WAKE tests */

    /* Add WG tests */

    /* Add ZK-Crypt tests */

  } while( 0 );

  return( err );
}
